package com.yzh.ios3;

import java.io.*;

/**
 * @author 于振晗
 * @title: CopyFileTest2
 * @description: TODO 文件复制，字符流
 * @date 2020年09月07日
 * @path com.yzh
 */
public class CopyFileTest2 {
    public static void main(String[] args) throws IOException{
        Reader fr = new FileReader("D:/test1.txt");
        Writer fw = new FileWriter("D:/test2.txt");
        char [] cbuf = new char[1024];
        int len = 0;
        while((len = fr.read(cbuf))!=-1){
            fw.write(cbuf,0,len);
        }
        //3. 关闭输入流和输出流
        fr.close();
        fw.close();
    }
}
